<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 用name变量接收用户输入的用户名
    let name = prompt('请输入用户名')
    // 输出到body中
    document.write(name)
  </script>
</body>

</html>